<?php
	/* Define global variables */
	$_GLOBALS['libdir'] = "lib";

	/* Define classes */
	require_once $_GLOBALS['libdir']."/application.class.php";
	require_once $_GLOBALS['libdir']."/database.class.php";
	require_once $_GLOBALS['libdir']."/user.class.php";

	/* Create an application object */
	$_GLOBALS['app'] = new AJD_Application(
		"phpAjaxyDoors",
		"phpAjaxyDoors",
		"Why look through windows when you can go through doors?",
		"myusers");

	/* Start the session */
	session_start();

	/* Make sure that we either we came from the index page, or we have a user */
	if(! isset($index)) include('security.php');
	
	/* Create a database connection */
	if (empty($_SESSION['db']))
	{
		$_SESSION['db'] = new AJD_Database(
			"DoorsOnLocalhost",
			"localhost",
			"root",
			"rootwdp",
			"doors"			
		);
	}
?>
